package com.hzspace.counter;

import java.util.concurrent.atomic.AtomicInteger;

/**
 * @Author: LiuHao
 * @Descirption:
 * @Date: 2019/6/14_15:42
 */
public class Counter4 {

    private AtomicInteger count = new AtomicInteger();

    public void add(){
        try{
            for(int i=0; i<200; i++){
                Thread.sleep(100);
                System.out.println(count.incrementAndGet());
            }
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
